package com.lyn.solitude.api

import android.app.Application
import android.content.Context
import android.content.Intent
import android.content.res.AssetManager
import android.content.res.Resources
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.view.ContextMenu
import android.view.ContextMenu.ContextMenuInfo
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.view.Window
import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import androidx.annotation.IdRes
import androidx.annotation.StringRes
import androidx.appcompat.app.ActionBar
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleCoroutineScope
import com.lyn.solitude.entity.Plugin

/**
 * @author longyn 2024/5/11
 * @version 1.0.0
 */
interface PluginLifecycleApi {

    fun onPluginHostAidl(pluginHostAidl: PluginHostAidl)

    fun getPluginHostAidl(): PluginHostAidl

    fun onPlugin(plugin: Plugin)

    fun getPlugin(): Plugin

    fun getActivity(): AppCompatActivity

    fun getContext(): Context

    fun onActivity(activity: AppCompatActivity)

    fun onCreate(savedInstanceState: Bundle?)

    fun setContentView(layoutId: Int)

    fun setContentView(contentView: View?)

    fun getIntent(): Intent

    fun getAssets(): AssetManager

    fun getClassLoader(): ClassLoader

    fun getResources(): Resources

    fun getString(@StringRes resId: Int): String

    fun getColor(@ColorRes resId: Int): Int

    fun getDrawable(@DrawableRes redId: Int): Drawable

    fun getLayoutInflater(): LayoutInflater

    fun onCreateOptionsMenu(menu: Menu?): Boolean

    fun onCreateContextMenu(menu: ContextMenu?, v: View?, menuInfo: ContextMenuInfo?)

    fun onOptionsItemSelected(item: MenuItem): Boolean

    fun onMenuOpened(featureId: Int, menu: Menu): Boolean

    fun onNewIntent(intent: Intent?)

    fun onRestart()

    fun onStart()

    fun onResume()

    fun onPause()

    fun onDestroy()

    fun onRequestPermissionsResult(
        requestCode: Int, permissions: Array<String?>,
        grantResults: IntArray
    )

    fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?)

    fun isNotBackPressed(): Boolean

    fun onBackPressed()

    fun getSupportFragmentManager(): FragmentManager

    fun getApplication(): Application

    fun startPluginActivity(pluginClass: Class<out PluginLifecycleApi?>)

    fun startActivity(intent: Intent?)

    fun startActivity(intent: Intent?, options: Bundle?)

    fun startActivityForResult(intent: Intent?, requestCode: Int)

    fun startActivityForResult(intent: Intent?, requestCode: Int, options: Bundle?)


    fun getSupportActionBar(): ActionBar

    fun finish()

    fun <T : View?> findViewById(@IdRes id: Int): T

    fun getWindow(): Window

    fun <T> getSystemService(serviceClass: Class<T>?): T

    fun getSystemService(name: String?): Any

    fun getMenuInflater(): MenuInflater

    fun getLifecycle(): Lifecycle

    fun lifecycleScope(): LifecycleCoroutineScope

    fun checkSelfPermission(permission: String): Int

    fun requestPermissions(permissions: Array<String>, requestCode: Int)
}